package com.zshan.clinic.common.enums;


import com.zshan.clinic.common.util.string.StringUtil;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 中药煎法
 */
public enum DecotionMethodEnum {

    SKIN_TEST("1", "先煎"),
    ADD_LATER_HALF_HOUR("2", "先煎半小时"),
    ADD_LATER_ONE_HOUR("3", "先煎一小时"),
    GRIND("4", "先炒"),
    INCLUDE("5", "后下"),

    PACKAGE("6", "包煎"),
    AFTER_MIX("7", "另煎"),

    GRIND_HARD("8", "炒化"),
    GRIND_HARD_MELT("9", "烊化"),

    DECANT("10", "冲服"),
    MIX_LAST("11", "捣碎"),
    SWALLOW("12", "吞服"),
    GRIND_FINE("13", "煎汤代水"),
    MIX_IN("14", "兑入"),
    MAKE_POWDER("15", "打粉"),
    DECOCTION("16", "另包");



    private String value;
    private String text;

    private DecotionMethodEnum(String value, String text) {
        this.value = value;
        this.text = text;
    }

    public String getValue() {
        return this.value;
    }

    public String getText() {
        return this.text;
    }

    public static DecotionMethodEnum getValue(String value) {
        if(StringUtil.isBlank(value)){
            return null;
        }
        DecotionMethodEnum[] arr$ = values();
        int len$ = arr$.length;
        for(int i$ = 0; i$ < len$; ++i$) {
            DecotionMethodEnum dot = arr$[i$];
            if (value.equals(dot.getValue())) {
                return dot;
            }
        }
        return null;
    }

    public static String getText(String value) {
        if(StringUtil.isBlank(value)){
            return null;
        }
        DecotionMethodEnum[] arr$ = values();
        int len$ = arr$.length;
        for(int i$ = 0; i$ < len$; ++i$) {
            DecotionMethodEnum dot = arr$[i$];
            if (value.equals(dot.getValue())) {
                return dot.getText();
            }
        }
        return null;
    }

    public static boolean isValue(String value) {
        if(StringUtil.isBlank(value)){
            return false;
        }
        DecotionMethodEnum[] arr$ = values();
        int len$ = arr$.length;
        for(int i$ = 0; i$ < len$; ++i$) {
            DecotionMethodEnum dot = arr$[i$];
            if (value.equals(dot.getValue())) {
                return true;
            }
        }
        return false;
    }

    public Map toMap() {
        Map map = new HashMap();
        map.put("value", this.value);
        map.put("text", this.text);
        return map;
    }

    public static List<Map> allToMap() {
        List<Map> list = new ArrayList();
        DecotionMethodEnum[] arr$ = values();
        int len$ = arr$.length;
        for(int i$ = 0; i$ < len$; ++i$) {
            DecotionMethodEnum dot = arr$[i$];
            list.add(dot.toMap());
        }
        return list;
    }
}
